﻿
using System.Collections.Generic;


namespace IntelHexParser
{
	/// <summary>
	/// Represents a memory block of hex code.  The Lines property contains the actual raw lines of hex data minue the record marker ":".
	/// </summary>
	public class SegmentBlock
	{
		/// <summary>
		/// The Extended Segment Address to apply to each line if not null.  Apply by multipling by 16 and adding to each line's address
		/// </summary>
		public string ExtendedSegmentAddress { get; set; }


		/// <summary>
		/// The Start Segment Address to apply to each line if not null.
		/// </summary>
		public byte[] StartSegmentAddress { get; set; }


		/// <summary>
		/// The size in bytes of this memory block
		/// </summary>
		public int Size { get; set; }


		/// <summary>
		/// The Starting address for the segment, upper 16-bits.  Add to the address on each data record (line)
		/// </summary>
		public byte[] StartingAddress { get; set; }


		/// <summary>
		/// The raw hex data lines.  Does not include the ":" record marker character but does include the checksum.  This does not include any record type but the data records.
		/// </summary>
		public List<string> Lines { get; set; }


		/// <summary>
		/// Create an empty SegmentBlock
		/// </summary>
		public SegmentBlock()
		{
			this.Lines = new List<string>();
			this.ExtendedSegmentAddress = null;
			this.Size = 0;
			this.StartingAddress[0] = 0x00;
			this.StartingAddress[1] = 0x00;
			this.StartingAddress[2] = 0x00;
			this.StartingAddress[3] = 0x00;
		}
	}
}
